/**
 * Created by liguangsong on 16/8/4.
 */
import React from 'react'
import PlayerInfoView from './playerInfoView.js'
import getTeamColor from '../../assist/teamColor.js'


var TeamPlayerView = React.createClass( {

    getTeamPlayerView() {
        var view = [];
        var color = getTeamColor(this.props.teamName);
        for (var i = 0; i < this.props.allPlayer.length; i++) {
            var player = this.props.allPlayer[i];
            view.push(
                <PlayerInfoView color={color} playerName={player[3]} locationAndNumber={(player[5] + ' ' +  player[4])}
                                playerId={player[12]} age={player[9]} height={player[6]} weight={player[7]} key={i} />
            )
        }

        return view;
    },


    render() {
        return (
            <div className="teamPlayerView">
                { this.getTeamPlayerView() }
            </div>
        )
    }
});


export default TeamPlayerView;